﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using SureKAM.BackUp.Notify.DataAccess;
using SureKAM.BackUp.Notify.DataAccess.implement;

namespace SureKAM.BackUp.Noitfy.DataAccess.Test
{
    public class NotifyResTestFixture
    {
        private INotify notify;

        [TestFixtureSetUp]
        public  void  TestFixtureSetUp()
        {
            notify = new NotifyRes();
        }

        [Test]
        public void GetNotifysTest()
        {
            List<Notify.Domain.Notify> notifies = this.notify.GetNotifys();
            Assert.IsNotNull(notifies);
        }

        [Test]
        public void InsertNotify()
        {
            Notify.Domain.Notify notify=new Notify.Domain.Notify();
            notify.ID = Guid.NewGuid().ToString();
            notify.Name = "Jeffrey";
            notify.Email = "JerferyHong@Hotmail.com";
            string TestResult = this.notify.InsertNotify(notify);
            this.notify.SaveToFile();
            Assert.IsNotNull(TestResult);
        }

        [Test]
        public void GetNotifyByIdTest()
        {
            string ID = "8e4240d5-2b77-4c35-a07a-8acbb15dfa8b";
            Notify.Domain.Notify notify = this.notify.GetNotifyById(ID);
            Assert.IsNotNull(notify);
        }

        [Test]
        public void UpdateNotifyTest()
        {
            string ID = "8e4240d5-2b77-4c35-a07a-8acbb15dfa8b";
            Notify.Domain.Notify notify = this.notify.GetNotifyById(ID);
            notify.Name = "Tony";
            this.notify.SaveToFile();
            Notify.Domain.Notify notify1 = this.notify.GetNotifyById(ID);
        }

        [Test]
        public void DeleteNotifyTest()
        {
            string ID = "8e4240d5-2b77-4c35-a07a-8acbb15dfa8b";
            bool reslut = this.notify.DeleteNotify(ID);
            this.notify.SaveToFile();
            Assert.IsTrue(reslut);
        }
    }
}
